#!/usr/bin/env python
# encoding: utf-8
import sys
sys.path.append("..")
from utils import decode_websocket_package,encode_websocket_package

async def WebsocketPackageMiddleware(context):
    """ 
    处理websocket 网关发送过来的请求
    """
    requestPacket= decode_websocket_package(context.request)
    result = await context.next()
    return encode_websocket_package(result,requestPacket)

    